package com.credit.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.credit.common.ServerResponse;
import com.credit.mapper.balanceSheetMapper;
import com.credit.mapper.flowsMapper;
import com.credit.mapper.profitMapper;
import com.credit.pojo.balanceSheet;
import com.credit.pojo.flows;
import com.credit.pojo.profit;
import com.credit.service.IFinanceService;
import com.credit.vo.YearVo;

@Service
public class FinanceServiceImpl implements IFinanceService{

	@Autowired
	private balanceSheetMapper balanceSheetMapper;
	
	@Autowired
	private flowsMapper flowsMapper;

	@Autowired
	private profitMapper profitMapper;
	
	
	
	
	
	//资产负债
	public ServerResponse insertBalanceSheet(balanceSheet record) {
		
		return ServerResponse.createBySuccess(balanceSheetMapper.insertBalanceSheet(record));
	}

	public ServerResponse selectBalanceSheetKey(Integer id) {
		
		return ServerResponse.createBySuccess(balanceSheetMapper.selectBalanceSheetKey(id));
	}

	public ServerResponse updateBalanceSheet(balanceSheet record) {
		
		return ServerResponse.createBySuccess(balanceSheetMapper.updateBalanceSheet(record));
	}

	public ServerResponse BalanceSheet(YearVo y) {
		List<balanceSheet> list=balanceSheetMapper.selectBalanceSheet(y);
		if(list==null) {
			return ServerResponse.createBySuccess("201","还没有添加");
		}
		return ServerResponse.createBySuccess(list);
	}

	
	
	
	public ServerResponse insertFlows(flows record) {
		
		return ServerResponse.createBySuccess(flowsMapper.insertFlows(record));
	}

	public ServerResponse selectFlowsKey(Integer id) {
		
		return ServerResponse.createBySuccess(flowsMapper.selectFlowsKey(id));
	}

	public ServerResponse updateFlows(flows record) {
		
		return ServerResponse.createBySuccess(flowsMapper.updateFlows(record));
	}

	public ServerResponse selectFlows(YearVo y) {
		List<flows> list=flowsMapper.selectFlows(y);
		if(list==null) {
			return ServerResponse.createBySuccess("201","还没有添加");
		}
		return ServerResponse.createBySuccess(list);
	}

	
	
	public ServerResponse insertProfit(profit record) {
		
		return ServerResponse.createBySuccess(profitMapper.insertProfit(record));
	}

	public ServerResponse selectProfitKey(Integer id) {
		
		return ServerResponse.createBySuccess(profitMapper.selectProfitKey(id));
	}

	public ServerResponse updateProfit(profit record) {
		
		return ServerResponse.createBySuccess(profitMapper.updateProfit(record));
	}

	public ServerResponse selectProfit(YearVo y) {
		List<profit> list=profitMapper.selectProfit(y);
		if(list==null) {
			return ServerResponse.createBySuccess("201","还没有添加");
		}
		return ServerResponse.createBySuccess(list);
	}
}
